package com.cyy.daijia.driver.client.fallback;

import com.cyy.daijia.common.result.Result;
import com.cyy.daijia.driver.client.OcrFeignClient;
import com.cyy.daijia.model.vo.driver.DriverLicenseOcrVo;
import com.cyy.daijia.model.vo.driver.IdCardOcrVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.multipart.MultipartFile;
@Slf4j
public class OcrFallBack implements FallbackFactory<OcrFeignClient> {
    @Override
    public OcrFeignClient create(Throwable cause) {
        return new OcrFeignClient() {
            @Override
            public Result<IdCardOcrVo> idCardOcr(MultipartFile file) {
                log.error("身份验证失败",cause);
                throw new RuntimeException();

            }

            @Override
            public Result<DriverLicenseOcrVo> driverLicenseOcr(MultipartFile file) {
                log.error("身份验证失败",cause);
                throw new RuntimeException();
            }
        };
    }
}
